package by.pavlyukevich.paymentsystem.datamodel.user;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import by.pavlyukevich.paymentsystem.datamodel.AbstractEntity;
import by.pavlyukevich.paymentsystem.datamodel.payment.PaymentType;

@Entity
public class Contractor extends AbstractEntity<Integer> {

	@Column
	@NotNull
	@Size(max = 200)
	private String name;

	@Column
	@NotNull
	@Min(value = 1000000000000L)
	@Max(value = 9999999999999L)
	private Long unp;

	@Column
	@NotNull
	@Size(max = 100)
	private String email;

	@OneToMany(mappedBy = "contractor", cascade = { CascadeType.ALL }, orphanRemoval = true)
	private Set<PaymentType> paymentTypes;

	@OneToMany(mappedBy = "contractor", cascade = { CascadeType.ALL }, orphanRemoval = true)
	private Set<UserAccount> userAccounts;

	public Set<PaymentType> getPaymentTypes() {
		return paymentTypes;
	}

	public void setPaymentTypes(Set<PaymentType> paymentTypes) {
		this.paymentTypes = paymentTypes;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Long getUnp() {
		return unp;
	}

	public void setUnp(Long unp) {
		this.unp = unp;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public Set<UserAccount> getUserAccounts() {
		return userAccounts;
	}

	public void setUserAccounts(Set<UserAccount> userAccounts) {
		this.userAccounts = userAccounts;
	}

}
